<?php

namespace App\Http\Requests\App\WechatUser;

use App\Http\Requests\ApiRequest;
use App\Models\Panx\Sex;
use Illuminate\Validation\Rule;

/**
 * @property string store_id
 * @property string staff_id
 * @property string|null nickname
 * @property string openid
 */
class UpdateOrCreateRequest extends ApiRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'openid'          => 'required|string',
            'nickname'        => 'sometimes|required|string',
            'sex'             => ['sometimes','required','int' , Rule::in(Sex::allSex())],
            'language'        => 'sometimes|required|string',
            'district'        => 'sometimes|required|string',
            'city'            => 'sometimes|required|string',
            'country'         => 'sometimes|required|string',
            'headimgurl'      => 'sometimes|required|string',
            'latitude'        => 'sometimes|required|string',
            'longitude'       => 'sometimes|required|string',
            'subscribe'       => 'sometimes|required|int|in:0,1',
            "province"        => 'sometimes|required|string',
            "subscribe_time"  => 'sometimes|required|int',
            "remark"          => 'sometimes|required|string',
            'subscribe_scene' => 'sometimes|required|string',
        ];
    }
}
